//
//  ZZReplayBigFansDetailVC.m
//  新项目
//
//  Created by liGordon on 17/3/15.
//  Copyright © 2017年 刘耀宗. All rights reserved.
//

#import "ZZReplayBigFansDetailVC.h"
#import "ZZReplayBogFansContentModel.h"
#import "ZZReplayBigFansDetailCell.h"

static NSString * identifier = @"ReplayBigFansDetailCell";
@interface ZZReplayBigFansDetailVC ()<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) IBOutlet UITableView *menuTable;

@property (nonatomic ,strong)ZZReplayBogFansContentModel *detailModel;
@end

@implementation ZZReplayBigFansDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    _menuTable.delegate = self;
    _menuTable.dataSource = self;
    self.title = @"维修忠实分析";
    [_menuTable registerNib:[UINib nibWithNibName:@"ZZReplayBigFansDetailCell" bundle:nil]forCellReuseIdentifier:identifier];
    _menuTable.separatorStyle = UITableViewCellSeparatorStyleNone;
}
-(void)setModel:(ZZReplayBogFansContentModel *)model
{
    _model = model;
    self.detailModel = model;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 9;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ZZReplayBigFansDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    cell.model = self.model;
    if (indexPath.row == 0) {
        cell.titleName.text = @"维修次数";
        if([self.detailModel.Surplus length]<=0){
            cell.detailName.text = @"暂无维修次数";
            
        }else{
            cell.detailName.text = self.detailModel.Surplus;
            
        }
    }else if (indexPath.row == 1){
        NSString *timeStrT =  [self.detailModel.CreationTime substringToIndex:16];
        NSString *timeStr = [timeStrT stringByReplacingOccurrencesOfString:@"T" withString:@" "];
        cell.titleName.text = @"创建日期";
        
        if([self.detailModel.CreationTime length]<=0){
            
            cell.detailName.text = @"暂无创建日期";
            
        }else{
            cell.detailName.text = timeStr;
            
        }
        
    }else if (indexPath.row == 2){
        cell.titleName.text = @"车牌号";
        
        
        if([self.detailModel.PlateNumber length]<=0){
            
            cell.detailName.text = @"暂无车牌号";
            
        }else{
            
            cell.detailName.text = self.detailModel.PlateNumber;
            
        }
        
        
        
    }else if (indexPath.row == 3){
        cell.titleName.text = @"车主电话";
        
        if([self.detailModel.CarOwnerTel length]<=0){
            
            cell.detailName.text = @"暂无车主电话";
            
        }else{
            cell.detailName.text = self.detailModel.CarOwnerTel;
        }
        
    }else if (indexPath.row == 5){
        cell.titleName.text = @"车型";
        if([self.detailModel.ModelName length]<=0){
            
            cell.detailName.text = @"暂无车型";
            
        }else{
            cell.detailName.text = self.detailModel.ModelName;
        }
        
    }else if (indexPath.row == 4){
        cell.titleName.text = @"车主名称";
        if([self.detailModel.CarOwner length]<=0){
            
            cell.detailName.text = @"暂无车主名称";
            
        }else{
            cell.detailName.text = self.detailModel.CarOwner;
        }
        
    }else if (indexPath.row == 6){
        cell.titleName.text = @"车辆性质";
        if([self.detailModel.CarProperty length]<=0){
            
            cell.detailName.text = @"暂无车辆性质";
            
        }else{
            cell.detailName.text = self.detailModel.CarProperty;        }
        
        
        
    }else if (indexPath.row == 7){
        cell.titleName.text = @"会员ID";
        if([self.detailModel.MemberId length]<=0){
            
            cell.detailName.text = @"暂无会员ID";
            
        }else{
            cell.detailName.text = self.detailModel.MemberId;
        }
        
        
    }else if (indexPath.row == 8){
        cell.titleName.text = @"会员Code";
        if([self.detailModel.MemberCode length]<=0){
            
            cell.detailName.text = @"暂无会员Code";
            
        }else{
            cell.detailName.text = self.detailModel.MemberCode;
        }
        
    }

    return cell;
}

@end
